perm filename NEWLSP.DCS[UP,DOC] blob sn#347221 filedate 1978-04-09 generic text, type C, neo UTF8
COMMENT āŠ—   VALID 00007 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002				LISP 1.6 Manual Update
C00004 00003	A. IMPROVEMENTS
C00006 00004	B. NEW FEATURES
C00008 00005	
C00014 00006	
C00018 00007	C. USEFUL FUNCTIONS (non-resident)
C00019 ENDMK
CāŠ—;
			LISP 1.6 Manual Update


This document presents changes to the LISP interpreter to be
installed on 12-3-73.  It contains three sections:

A. Improvements (compatible) to the interpreter.
B. New features.
C. Additional useful packages now available.

None should affect the operation of current LISP-based systems, except
that they will have to be re-created to use it.

The old interpreter, and unconverted LISP-based systems, will continue
to operate correctly for some time after the conversion.  On some
not too distant date some necessary support files will be deleted, and
old systems will no longer support the LISP LOADER and GRINDEF/ALVINE
functions.

			Dan Swinehart
			28 Nov., 1973
A. IMPROVEMENTS

 1. Printing

    Teletype output is now buffered, resulting in increased speed.  Normally
    strings are printed only when the buffer is full, or when control
    returns from a printing to a non-printing function.  Thus, if the user
    calls TYO directly, each character is printed immediately, whereas if
    TYO is called by PRINT, the entire string will be printed at once.  The
    increased speed results from a reduction of expensive calls to the system.

    Additional speed increase may be obtained by use of the BUFFER function,
    documented below.

 2. SPEAK

    After the CONS count reaches a certain value, SPEAK does two CONSes in
    order to report the current CONS count.  This can distort delicate CONS
    measurements.

       (SPEAK) will simply return the current CONS count.
       (SPEAK n) will return the previous count, then set it to `n'.

 3. E (TV) files

    Here we are making a totally unwarranted assumption:  that no one will
    want to look at the directory page of a file created by E or TV.
    The new interpreter will ignore one whenever it sees it.  When and if
    anyone needs it, we will install a mode or something.
B. NEW FEATURES

  1. Teletype Buffering

    (BUFFER flag)	default flag is NIL

    (BUFFER T) causes the print routines to buffer (teletype) characters 
     until the buffer is full or a (BUFFER NIL) is executed.

    (BUFFER NIL) prints any buffered characters, then returns to the
     normal state, wherein characters are printed whenever control 
     returns from a printing to a non-printing routine.

     Buffering is useful whenever TYOs, PRINCs, and the like must be
     used to compose complex outputs.  By surrounding a series of 
     such outputs with a (BUFFER T)/(BUFFER NIL) pair, one can achieve
     the same efficiency that PRINT would in printing the same number
     of characters.

  2. Random-Access Input/Output (disk files only, I think)

   (INOUT ..... )  has the same syntax as INPUT or OUTPUT.  It opens
     the file (which should be a disk file -- I doubt if it works on
     DECtapes) for both input and output.  This allows the USETI/USETO
     functions, below, to provide random-access operation.

     (INC channel ...) and (OUTC channel ...) can be applied to any 
     channel opened with INOUT, singly, or both at once.

   (USETI channel NIL) will return the number of the current
     record (128-word block) being read, starting with record 1.

   (USETI channel n) will return the current record number, as above,
     then will set the current block number to `n'.  The next S-expression
     read will be the first S-expression from that record.  In this
     case, S-expressions should not overlap record boundaries.

   (USETO channel NIL) will return the current output record number.  

   (USETO channel n) will return the current value, as above, then set
     it to `n'.  Be careful!  A USETI will change this number (and vice 
     versa), although the correct USET must be done for the corresponding 
     operations (INC/OUTC) to work right -- a property of this system.

     After a USETO, the next S-expression written will be written into
     the first word of record `n'.  Any previous data written into that
     record, or any part of subsequent records without a USETO, are lost:
     each record is cleared just before anything is written into it.  CHSETO
     (below) offers partial relief for this feature.

   (USETO channel T) will set the output block number to the first
     record beyond the current end of file.  It will return that number.

   (CHSETI channel NIL) will return the current character number (starting
     with character 1) in the file.

   (CHSETI channel n) performs (CHSETI channel NIL), then sets the current
     character number to `n', by reading the appropriate record, then 
     modifying the internal counts and byte pointers so that the next
     S-expression read will begin at that point.  We take no responsibility
     for CHSETI operations which reference arbitrary points within
     S-expressions.

   (CHSETO channel NIL) returns the current output character location.

   (CHSETO channel n) performs (... NIL), then sets the output pointers
     to character `n', in a rather special way:
	a) It first reads the selected record, `r', if it exists.
	b) It then performs (USETO channel `r').
	c) Next it transfers the input data to the output area.
	d) Finally it adjusts the output counts and byte pointers to
	   indicate character `n'.

    Thus, one can replace part of a record without destroying the rest
    of the record.  If, however, writing continues into the record
    following, previous data from that record will be lost, as above.
    This is probably wrong, and should be fixed.

    If one performs CHSETO into the first non-existent record beyond the
    current file, a zeroed record will be created, and the output pointer
    set to the selected point within it.  If one selects any record beyond
    that one, undesired things will happen, without indicating any error
    conditions.

    There are 5 characters in a word, 128 words per record.

    Hopefully these features perform as advertised.  If they do not, chances
    are about even that it is a bug in LISP, a bug in the system, or a bug
    in someone's understanding about how random access works in the system.

  3. User IO routines

    These functions allow the user to substitute his own LISP functions
    for the operations of TYI and TYO, even when they are called internally
    from higher-level IO routines (like READ and PRINT).

    The user can open any channel as a User I/O channel.  The syntax is:

   (INPUT <channel> FN: <function name>...<function name>)
or (OUTPUT <channel> FN: <function name>)
or (INOUT <channel> FN: <function name>)

    Any function so specified should be declared as:

   (DE IOFUN (CODE CHAR) (....))

    CODE should be:
	NIL if IOFUN should provide input to TYI;
         T  if IOFUN should accept output from TYO.
        (This allows IOFUN to work with INOUT, see below).
 	Further codes may be added, for USETI, USETO (see below).

    CHAR should be:
	NIL  if Code is NIL (TYI).
	 A,  where A is a number representing the ASCII value of the
	     character to be written, if CODE is T (TYO).  See CODEVAL,
	     below.

    For TYI, IOFUN should generate a number representing the ASCII value
    of the character to be returned from TYI.  Alternatively, IOFUN can return
    @$EOF$, which will create an end of file condition on the channel.
    The CHRVAL function, described below, is useful for providing this
    ASCII number.

    For TYO, IOFUN should dispense with the ASCII character value which
    would otherwise be written to a file.  It may return anything it
    chooses, since its result is ignored.  The ASCII function is useful
    here for creating LISP PNAMEs from the character values sent to the
    TYO routine.

    INC and OUTC may be used recursively, within the user's IOFUN, to
    read or write from/to TTY or another real device, while, perhaps,
    monitoring or collecting for later reference all activity on that
    device.  I am not sure whether READ and PRINT will operate recursively
    in this sense, nor whether these pseudo-devices can select each other
    recursively.  Let me know what you find out.

   (CHRVAL X) returns the INUM representing the ASCII value of the print
    name of X.  For instance, (CHRVAL @ABCDE) is 101 (octal).



  4. (CNTSET F)
    F should be a function name.  CNTSET provides the address of this
    function to the interpreter, for use in implementing the counting
    facility described below.
C. USEFUL FUNCTIONS (non-resident)

This section will be added soon.  It is not crucial to the
installation of the new interpreter, since these functions
live in different files.


Until this section is complete, please refer to information
about the COUNTER package, the LTCONS package, etc., on
UTIL.DCS[LSP,RWW].